// 测试切片
import { createSlice } from "@reduxjs/toolkit";

interface TestState {
  name: string;
  age: number;
}

const initialState: TestState = {
  name: "小红",
  age: 20,
};

const testSlice = createSlice({
  name: "test", // 切片名称
  initialState,

  reducers: {
    setName(state, action) {
      state.name = action.payload;
    },

    setAge(state, action) {
      state.age = action.payload;
    },
  },
});

export const { setName, setAge } = testSlice.actions; // 直接到出直接用 20250121
export default testSlice.reducer;
